

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title><g:message code="product.nav.edit"/></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><g:link class="list" action="list"><g:message code="product.nav.list"/></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="product.nav.create"/></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="product.nav.edit"/></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${productInstance}">
            <div class="errors">
                <g:renderErrors bean="${productInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${productInstance?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="currentCost">${message(code:'product.table.currentCost')}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'currentCost','errors')}">
                                    <input type="text" id="currentCost" name="currentCost" value="${fieldValue(bean:productInstance,field:'currentCost')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="currentPrice">${message(code:'product.table.currentPrice')}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'currentPrice','errors')}">
                                    <input type="text" id="currentPrice" name="currentPrice" value="${fieldValue(bean:productInstance,field:'currentPrice')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name">${message(code:'product.table.name')}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'name','errors')}">
                                    <input type="text" id="name" name="name" value="${fieldValue(bean:productInstance,field:'name')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="productCategory">${message(code:'product.table.category')}:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:productInstance,field:'productCategory','errors')}">
                                    <g:select optionKey="id" from="${ProductCategory.list()}" name="productCategory.id" value="${productInstance?.productCategory?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="${message(code:'common.button.save')}" action="update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
